//package com.example.springsecurity.config;
//
//import org.springframework.boot.autoconfigure.security.SecurityProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.annotation.Order;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//import org.springframework.security.core.userdetails.User;
//import org.springframework.security.core.userdetails.UserDetails;
//import org.springframework.security.core.userdetails.UserDetailsService;
//import org.springframework.security.provisioning.InMemoryUserDetailsManager;
//
//@Configuration
//@Order(SecurityProperties.BASIC_AUTH_ORDER - 10)
//public class ApplicationConfigurerAdapter extends WebSecurityConfigurerAdapter {
//
//
//    @Override
//    protected void configure(HttpSecurity http) throws Exception {
////        super.configure(http);
//        http.antMatcher("/foo/**")
//                .authorizeRequests()
//                .antMatchers("/foo/bar").hasRole("BAR")
//                .antMatchers("/foo/spam").hasRole("SPAM")
//                //Maps any request.
//                .anyRequest()
//                //Specify that URLs are allowed by any authenticated user.
//                .authenticated();
//
//
//    }
//
//    @Bean
//    @Override
//    public UserDetailsService userDetailsService() {
//        UserDetails user =
//                User.withDefaultPasswordEncoder()
//                        .username("user")
//                        .password("password")
//                        .roles("USER")
//                        .roles("BAR")
//                        .roles("SPAM")
//                        .build();
//
//        return new InMemoryUserDetailsManager(user);
//    }
//}
//
